using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using CSP.Model.CSP;

namespace CSP.DataAccess.Mapping
{
    public class DomainTypeMap : EntityTypeConfiguration<DomainType>
    {
        public DomainTypeMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("DomainType");
            this.Property(t => t.Id).HasColumnName("id");
            this.Property(t => t.Name).HasColumnName("name");
            this.Property(t => t.OrderId).HasColumnName("orderid");
            this.Property(t => t.Status).HasColumnName("status");
        }
    }
}
